<?php
namespace Admin\Controller;
use Think\Controller;
class AjaxController extends Controller {


 function send_sms(){

            Vendor('sms.httpUtil');
            $http=new \httpUtil;
            $funAndOperate = "industrySMS/sendSMS";

            // 参数详述请参考http://miaodiyun.com/https-xinxichaxun.html

            // 生成body
            $body =  $http->createBasicAuthData();
            // 在基本认证参数的基础上添加短信内容和发送目标号码的参数
            // print_r($body);die;
            $code=mt_rand(1000,9999);
            // print_r($body['to']);die;
            $body['smsContent'] = "【云海科技】登录验证码：".$code."，如非本人操作，请忽略此短信。";
            $body['to'] = I('post.tell');

            // 提交请求
            $result =  $http->post($funAndOperate, $body);
            // $result
            // echo("<br/>result:<br/><br/>");die;
            $status= json_decode($result,true)['respCode'];
            echo($status==00000)?1:0;
            //echo $status;
    }

 function GetSpec(){

      $id=I('get.id');

      $goods_item =D('spec')->relation(true)->where("goods_type_id=$id")->select();

      // print_r($goods_item);die;
      $this->ajaxReturn($goods_item);//返回数据

    }



 function Appand_spec(){
            if(s('spec_item')){
                  // unset($cache->name);
            $spec_item=s('spec_item');//放入缓存

            $spec_item[I('post.spec_rule')]=I('post.');
// print_r($spec_item[I('post.spec_rule')]);die;
            }else{

            $spec_item[I('post.spec_rule')]=I('post.');
            // S('spec_item',I('post.'));
            }
s('spec_item',$spec_item);
// print_r(S('spec_item'));die;
// print_r($_POST);die;
 $this->ajaxReturn(S('spec_item'));//返回数据

    }




}